﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NRCP.BusinessEntities;
using NRCP.BusinessLogicLayer;
using NRCP.Helpers;

/// <summary>
/// Summary description for SessionManager
/// </summary>
public class SessionManager
{
    private static string LOGGEDIN_USER_NAME_KEY = "LOGGEDIN_USER_NAME";
    private static string NATIONALPLAN_MONTHLY_KEY = "NATIONALPLAN_MONTHLY_KEY";
    private static string TEMP_NATIONALPLAN_MONTHLY_KEY = "TEMP_NATIONALPLAN_MONTHLY_KEY";
    private static string TEMP_VAL_CONTAINER_KEY = "TEMP_VAL_CONTAINER_KEY";
    private static string TEMP_ID_CONTAINER_KEY = "TEMP_ID_CONTAINER_KEY";
    private static string TEMP_UPAZILA_KEY = "TEMP_UPAZILA_KEY";
    private static string TEMP_PLAN_SUMMARY_KEY = "TEMP_PLAN_SUMMARY_KEY";


    public static List<TempValueObject> TEMP_PLAN_SUMMARY
    {
        get
        {
            try
            {
                if (HttpContext.Current.Session[TEMP_PLAN_SUMMARY_KEY] != null)
                    return HttpContext.Current.Session[TEMP_PLAN_SUMMARY_KEY] as List<TempValueObject>;
                else
                    return new List<TempValueObject>();
            }
            catch
            {
                return null;
            }
        }
        set
        {
            HttpContext.Current.Session[TEMP_PLAN_SUMMARY_KEY] = value;
        }
    }


    public static string LOGGEDIN_USER_NAME
    {
        get
        {
            try
            {
                return HttpContext.Current.Session[LOGGEDIN_USER_NAME_KEY].ToString();
            }
            catch
            {
                return string.Empty;
            }
        }
        set
        {
            HttpContext.Current.Session[LOGGEDIN_USER_NAME_KEY] = value;
        }
    }

    public static List<SubDistrict> UPAZILA
    {
        get
        {
            try
            {

                if (HttpContext.Current.Session[TEMP_UPAZILA_KEY] != null)
                    return HttpContext.Current.Session[TEMP_UPAZILA_KEY] as List<SubDistrict>;
                else
                    return new List<SubDistrict>();

            }
            catch
            {
                return null;
            }
        }
        set
        {
            HttpContext.Current.Session[TEMP_UPAZILA_KEY] = value;
        }
    }

    public static List<NationalPlanDetailsMonthly> NATIONALPLAN_MONTHLY
    {
        get
        {
            try
            {

                if (HttpContext.Current.Session[NATIONALPLAN_MONTHLY_KEY] != null)
                    return HttpContext.Current.Session[NATIONALPLAN_MONTHLY_KEY] as List<NationalPlanDetailsMonthly>;
                else
                    return new List<NationalPlanDetailsMonthly>();
                
            }
            catch
            {
                return null;
            }
        }
        set
        {
            HttpContext.Current.Session[NATIONALPLAN_MONTHLY_KEY] = value;
        }
    }

    public static List<TempMonthScheduler> TEMP_NATIONALPLAN_MONTHLY
    {
        get
        {
            try
            {
                if (HttpContext.Current.Session[TEMP_NATIONALPLAN_MONTHLY_KEY] != null)
                    return HttpContext.Current.Session[TEMP_NATIONALPLAN_MONTHLY_KEY] as List<TempMonthScheduler>;
                else
                    return new List<TempMonthScheduler>();
            }
            catch
            {
                return null;
            }
        }
        set
        {
            HttpContext.Current.Session[TEMP_NATIONALPLAN_MONTHLY_KEY] = value;
        }
    }

    public static List<TempValueObject> TEMP_VAL_CONTAINER
    {
        get
        {
            try
            {
                if (HttpContext.Current.Session[TEMP_VAL_CONTAINER_KEY] != null)
                    return HttpContext.Current.Session[TEMP_VAL_CONTAINER_KEY] as List<TempValueObject>;
                else
                    return new List<TempValueObject>();
            }
            catch
            {
                return null;
            }
        }
        set
        {
            HttpContext.Current.Session[TEMP_VAL_CONTAINER_KEY] = value;
        }
    }

    public static List<Int32> TEMP_ID_CONTAINER
    {
        get
        {
            try
            {
                if (HttpContext.Current.Session[TEMP_ID_CONTAINER_KEY] != null)
                    return HttpContext.Current.Session[TEMP_ID_CONTAINER_KEY] as List<Int32>;
                else
                    return new List<Int32>();
            }
            catch
            {
                return null;
            }
        }
        set
        {
            HttpContext.Current.Session[TEMP_ID_CONTAINER_KEY] = value;
        }
    }
}
